package com.jhk;

public class OperClass {

	public OperClass() {}
	
	static public float avg(InputClass ic){	
		
		int result=0;
		for (int i=0; i<ic.arr.length; i++){
			result=result + ic.arr[i].age;
		}
		return result/(float)ic.arr.length;
		
	}

	static public float avg1(InputClass ic){
		int result=0;
		int n = 0;
		for (int i=0; i<ic.arr.length; i++){
			if(ic.arr[i].sex.equals("M")){
				n=n+1;
			}else { n = n;}		
		}	
		
		
		for (int i=0; i<ic.arr.length; i++){
			if(ic.arr[i].sex.equals("M")){
				result=result + ic.arr[i].pay;
			}else { result = result;}
			
			
		}
		return (float)result/n;
	}
	
	static public float avg2(InputClass ic){
		int result=0;
		int n = 0;
		for (int i=0; i<ic.arr.length; i++){
			if(ic.arr[i].sex.equals("F")&& 19<ic.arr[i].age && ic.arr[i].age<30){
				n=n+1;
			}else { n = n;}		
		}	
		
		
		for (int i=0; i<ic.arr.length; i++){
			if(ic.arr[i].sex.equals("F")&& 19<ic.arr[i].age && ic.arr[i].age<30){
				result=result + ic.arr[i].pay;
			}else { result = result;}
			
			
		}
		return (float)result/n;
	}
	
	static public String max1(InputClass ic){
		int result1 = 0;
		String result2=null;
		
		for (int i=9; i>=0; i--){
			if(ic.arr[i].pay >= ic.arr[i-1].pay){
				result1=ic.arr[i].pay;				
			}else { result1=result1;
			}	
		}		
		
		for(int i=0; i<ic.arr.length; i++){
			if(ic.arr[i].pay==result1){
				result2=ic.arr[i].name;
			}else result2=result2;
		}
		
		
		return result2;
	}
	
	
	static void  avg4(InputClass ic){
		
		
	}
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
}
